package com.dd.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

import javax.sql.DataSource;

public class JdbcConfig {

    @Value("${name}")
    private String name;
    @Value("${age}")
    private int age;
    @Value("${school}")
    private String school;
    @Value("${address}")
    private String address;
    @Bean
    public DataSource showDataSource() {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setDriverClassName(name);
        dataSource.setUrl(String.valueOf(Integer.parseInt(String.valueOf(age))));
        dataSource.setUsername(school);
        dataSource.setPassword(address);
        return dataSource;
    }
}
